package sqldbManagement.dbparklot.cj.utils;

import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.Date;

public class TimeUtil {

    public static Timestamp getNow(){
        return new Timestamp(new Date().getTime());
    }

    public static BigDecimal getPrice(Timestamp start,Timestamp end,double price){
        BigDecimal bigDecimal = new BigDecimal(price);

        long s = end.getTime()- start.getTime();

        s /= 1000;
        s = s % (60*60) == 0 ? s/3600 : s/3600+1;


        return bigDecimal.multiply(new BigDecimal(s));
    }
}
